/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-12-07 17:34:53
 * @LastEditors: GGB
 * @LastEditTime: 2021-12-08 07:02:05
 */
import { defineNuxtConfig } from 'nuxt3'

// https://v3.nuxtjs.org/docs/directory-structure/nuxt.config
export default defineNuxtConfig({
  meta: {
    title: 'Nuxt3 study',
    meta: [
      { charset: 'utf-8' },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1, user-scalable=0',
      },
      {
        hid: 'keywords',
        name: 'keywords',
        content: 'keywords',
      },
      {
        hid: 'description',
        name: 'description',
        content: 'description',
      },
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [],
  },

  css: ['assets/scss/index.scss'],

  // https://github.com/intlify/nuxt3
  buildModules: ['@intlify/nuxt3'],

  intlify: {
    default: 'cn',
    localeDir: 'locales',
    vueI18n: {
      locale: 'cn',
    },
  },

  vite: {
    css: {
      // https://github.com/nuxt-community/style-resources-module/issues/190
      // https://vite.nuxtjs.org/misc/common-issues/#styleresources
      preprocessorOptions: {
        scss: {
          additionalData: '@import "@/assets/scss/global.scss";',
        },
      },
    },
  },
  // env https://www.nuxtjs.cn/api/configuration-env  : 'https://api.sunofbeach.net/shop'
  // env: {
  //   // baseUrl: 'http://localhost:3000/api'
  // },

  router: {
    extendRoutes(routes: any) {
      routes.push({
        path: '*',
        redirect: '/404',
      })
    },
  },
  // Modules: https://go.nuxtjs.dev/config-modules
  // modules: [
  //   '@nuxtjs/axios',
  // ],
  // axios: {
  //   proxy: true,
  //   prefix: '/api/',
  //   credentials: true
  // },
  // proxy: {
  //   '/api/': {
  //     target: 'https://api.sunofbeach.net/shop',
  //     pathRewrite: {
  //       '^/api/': '/',
  //       changeOrigin: true
  //     }
  //   }
  // },

  // publicPath: https://github.com/nuxt/framework/issues/1467
  build: {

  },
})
